package reduce.fz.com.reduce.util;

import reduce.fz.com.reduce.bean.TargetSet;
import reduce.fz.com.reduce.bean.TeamDynamic;
import reduce.fz.com.reduce.bean.User;
import reduce.fz.com.reduce.bean.WitnessCard;
import reduce.fz.com.reduce.constant.ParamConst;

/**
 * Created by qingshengzheng on 15/12/11.
 */
public class TeamDynamicUtil {
    /**
     * 生成加入小组动态
     *
     * @param user
     * @param teamid
     * @return
     */
    public static TeamDynamic joinTeam(User user, Long teamid) {
        TeamDynamic dynamic = new TeamDynamic();
        dynamic.pubtime = System.currentTimeMillis();
        dynamic.srcuser=user;
        dynamic.teamid = teamid;
        dynamic.dynamictype = ParamConst.TEAM_DYNAMIC_TYPE_JOIN;
        return dynamic;
    }

    /**
     * 退出小组动态
     *
     * @param user
     * @param teamid
     * @return
     */
    public static TeamDynamic quitTeam(User user, Long teamid) {
        TeamDynamic dynamic = new TeamDynamic();
        dynamic.pubtime = System.currentTimeMillis();
        dynamic.srcuser=user;
        dynamic.teamid = teamid;
        dynamic.dynamictype = ParamConst.TEAM_DYNAMIC_TYPE_QUIT;
        return dynamic;
    }

    public static TeamDynamic pubWitness(User user, WitnessCard card)
    {
        TeamDynamic dynamic=new TeamDynamic();
        dynamic.pubtime=System.currentTimeMillis();
        dynamic.srcuser=user;
        dynamic.witnessCard=card;
        dynamic.dynamictype=ParamConst.TEAM_DYNAMIC_TYPE_PUB_WITNESS;
        return dynamic;
    }
    public static TeamDynamic targetSet(User user,TargetSet set)
    {
        TeamDynamic dynamic=new TeamDynamic();
        dynamic.pubtime=System.currentTimeMillis();
        dynamic.srcuser=user;
        dynamic.targetSet=set;
        dynamic.dynamictype=ParamConst.TEAM_DYNAMIC_TYPE_TARGET_SET;
        return dynamic;
    }

    /**
     * 完成目标
     * @param user
     * @param set
     * @return
     */
    public static  TeamDynamic completeTarget(User user,TargetSet set)
    {
        TeamDynamic dynamic=new TeamDynamic();
        dynamic.pubtime=System.currentTimeMillis();
        dynamic.srcuser=user;
        dynamic.targetSet=set;
        dynamic.dynamictype=ParamConst.TEAM_DYNAMIC_TYPE_COMPLETE_TARGET;
        return dynamic;

    }



    /**
     * 见证动态
     *
     * @param teamid
     * @return
     */
    public static TeamDynamic witness(User srcUser,User toUser, Long teamid, Long love_score, Long social_score, Long energy_score, Long intell_score) {
        TeamDynamic dynamic = new TeamDynamic();
        dynamic.pubtime = System.currentTimeMillis();
        dynamic.srcuser=srcUser;
        dynamic.teamid = teamid;
        dynamic.dynamictype = ParamConst.TEAM_DYNAMIC_TYPE_WITNESS;
       // dynamic.toUser=toUser;
        dynamic.love_score = love_score;
        dynamic.social_score = social_score;
        dynamic.energy_score = energy_score;
        dynamic.intell_score = intell_score;
        return dynamic;
    }


}
